-
-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Bring back ESM build (and fix bundle size) #381
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -18,26 +18,39 @@ | |||
"postpublish": "git checkout . && rm ./README.md" | |||
}, | |||
"main": "dist/index.js", | |||
"module": "dist/index.mjs", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not used by Node.js, only by ESM-enabled bundlers.
"typings": "dist/index.d.ts", | ||
"exports": { | ||
".": { | ||
"react-server": { | ||
"node": "./dist/react-server/index.js", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's important that this goes first, so it has priority over import
when compiled under Node.js.
We're not 100% ESM-compatible: https://nodejs.org/api/esm.html#esm_mandatory_file_extensions
But we don't want to be ESM-compatible anyway, because Next.js itself isn't, therefore the bundler will crash when it encounters imports from Next.js.
Rather, we want to stay in CJS land for Node.js and only use import
when bundling for the browser (webpack).
No description provided.